import { GCellRenderer } from "../../../../../com/mui/controls/GCellRenderer";
import { SEatBeansResult } from "../../../../../Message/Public/SEatBeansResult";
import { AvatarInfo } from "../../../resource/info/AvatarInfo";
import { AvatarType } from "../../../resource/info/AvatarType";
import { EntityUtil } from "../../../scene/layer/utils/EntityUtil";
import { Language } from "../../../../../extend/language/Language";
import { DisplayUtil } from "../../../../common/DisplayUtil";
import { AchievementBonusItem } from "../../achievement/item/AchievementBonusItem";
import { ObjCreate } from "../../common/ObjCreate";
import { GImageBitmap } from "../../../../../com/mui/controls/GImageBitmap";
import { AutoLayoutTextContainer } from "../../../../common/text/AutoLayoutTextContainer";
//class EatBeansBonusCellReander
    
    export  class EatBeansBonusCellReander extends GCellRenderer
    {
        constructor()
        {
            super();
            this.initView();
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            var loc5=undefined;
            var loc1=arg1 as SEatBeansResult;
            if (loc1 != null) 
            {
                this._bmpHead.imgUrl = AvatarInfo.getPlayerAvatarName(loc1.camp, loc1.sex, AvatarType.BIG, loc1.avatarId);
            }
            EntityUtil.getProxyName(loc1.entityId);
            this._txtContainer.setText(0, "[" + EntityUtil.getProxyName(loc1.entityId) + "]" + loc1.name);
            this._txtContainer.setText(1, Language.getStringByParam(80380, loc1.beans));
            this._txtContainer.setText(2, Language.getStringByParam(80381, loc1.kill));
            this._txtContainer.setText(3, Language.getStringByParam(80382, loc1.mark));
            var loc2=loc1.itemAmount;
            var loc3=0;
            var loc4=0;
            if (loc2 != null) 
            {
                var loc6=0;
                var loc7=loc2;
                for (loc5 in loc7) 
                {
                    loc3 = parseInt(loc5);
                    loc4 = loc2[loc5];
                    break;
                }
            }
            if (this._item != null) 
            {
                DisplayUtil.removeMe(this._item);
            }
            if (loc3 > 0 && loc4 > 0) 
            {
                this._item = new AchievementBonusItem(loc3, loc4);
                this._item.x = 189;
                this._item.y = 46;
                this.addChild(this._item);
            }
            return;
        }

        /* internal  */initView(): void
        {
            ObjCreate.createBg(0, 0, 238, 95, this);
            this.addChild(new GImageBitmap("GangFightsPlayerHeadBg.png", 9, 14));
            var loc1=ObjCreate.createGTextField("", 394, 431, 150, 20, this);
            loc1.htmlText = Language.getString(80376);
            this._txtContainer = new AutoLayoutTextContainer();
            this._txtContainer.verticalGap = 2;
            this._txtContainer.x = 82;
            this._txtContainer.y = 5;
            this._txtContainer.addNewText();
            this._txtContainer.addNewText();
            this._txtContainer.addNewText();
            this._txtContainer.addNewText();
            this.addChild(this._txtContainer);
            this._bmpHead = new GImageBitmap();
            this._bmpHead.x = 14;
            this._bmpHead.y = 19;
            this.addChild(this._bmpHead);
            return;
        }

        /* internal */ /* var */_txtContainer: AutoLayoutTextContainer;

        /* internal */ /* var */_bmpHead: GImageBitmap;

        /* internal */ /* var */_item: AchievementBonusItem;
    }
